<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 如果用户没有传值(undefined), 默认将a, b转换为0
      function sum(a, b) {
        let a = a === undefined ? 0 : a;
        let b = b === undefined ? 0 : b;

        return a + b;
      }
    </script>
  </body>
</html>
